package com.dsr;

import com.dsr.util.IdWorker;
import javafx.application.Application;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.Bean;
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
import org.springframework.web.client.RestTemplate;
import tk.mybatis.spring.annotation.MapperScan;

/**
 * @author dsr
 * @date 2020-06-21
 **/
@SpringBootApplication
@MapperScan("com.dsr.dao")
@EnableCaching
public class FlowersManger   {
    public static void main(String[] args) {
        System.setProperty("es.set.netty.runtime.available.processors","false");
        SpringApplication.run(FlowersManger.class, args);
    }

    @Bean
    public IdWorker getIdWorker(){
        return new IdWorker();
    }

    @Bean
    public RestTemplate getRestTemplate() {
        return new RestTemplate();
    }
//    @Bean
//    public ThreadPoolTaskScheduler taskScheduler(){
//        ThreadPoolTaskScheduler taskScheduler = new ThreadPoolTaskScheduler();
//        taskScheduler.setPoolSize(10);
//        taskScheduler.initialize();
//        return taskScheduler;
//    }
//    @Override
//    protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
//        return builder.sources(Application.class);
//    }

}
